Open-source News

Tachyum Gets FreeBSD Running On Their Prodigy ISA Emulation Platform For AI / HPC

Phoronix - Wed, 04/06/2022 - 18:16
Tachyum is a startup working on "the world's first universal processor" that can be used from AI to HPC to hyperscale computing needs. The Tachyum processor aims to replace the needs of discrete TPUs / GPUs / XPUs into a single homogeneous processor architecture. While still running as an emulated platform, Tachyum has announced that in addition to Linux they have managed to boot and run FreeBSD on their ISA...

Mesa 22.1 Open-Source Vulkan Drivers Prepare Support For New Extensions

Phoronix - Wed, 04/06/2022 - 17:45
Ahead of the upcoming Mesa 22.1 feature freeze, the Mesa Vulkan drivers both big and small have been preparing merge requests for wiring up a number of recently introduced Vulkan extensions...

New Wayland Protocol Proposed For Fractional Scaling

Phoronix - Wed, 04/06/2022 - 17:19
A new Wayland protocol has been proposed for dealing with fractional scaling of surfaces that paired with wp_viewport can be used for achieving fractional scaling...

AMDVLK 2022.Q2.1 Released With Fixes, New Extension

Phoronix - Wed, 04/06/2022 - 16:43
It had been over one month since the last AMDVLK code drop while now has been succeeded by a new AMDVLK version bring one new extension and several fixes...

10 Git tips we can't live without

opensource.com - Wed, 04/06/2022 - 15:00
10 Git tips we can't live without AmyJune Hineline Wed, 04/06/2022 - 03:00 Up Register or Login to like.

Git tips are a dime a dozen, and it's a good thing because you can never get enough of them. If you use Git every day, then every tip, trick, and shortcut you can find is potentially time and effort saved. I asked Opensource.com community members for their favorite Git hacks. Here they are!

More on Git What is Git? Git cheat sheet Markdown cheat sheet New Git articles add

The git add --patch (-p for short) command kicks off an interactive review of chunks of changes that you can add, split into smaller chunks, or ignore (among other things). That way, you can be sure to limit your changes to a specific commit.

Kevin Thull

I use git add -p to review changes a hunk at a time before they're committed. It lets you check whether you forgot to remove some sketchy ideas, stray comments, or other things you shouldn't commit.

Ryan Price

amend

The Git option --amend is a helpful alternative to creating several commits and then squashing them into one commit through an interactive rebase. I like that you can continually amend your first commit to add additional changes as necessary.

Ashley Hardin

bisect

I know I screwed something up, but I have no idea when. That's what git-bisect is for.

In a previous life, I was a backend developer of Drupal and WordPress at an agency outside of Chicago. I had multiple customer sites I was working on at any one time, bouncing back and forth between them like a pinball. Every now and then, someone would find an undocumented feature in my code and, with fuzzy memory because of all the different client sites, git-bisect would come in handy with helping me find the culprit.

Eric Michalsen

blame

Contrary to the name of the git blame command, I don't use it to blame others. It's great when you're taking over repositories that you didn't initialize. You can see when certain changes were completed and hopefully the commit messages behind them too. It's a wonderful troubleshooting tool.

Miriam Goldman

checkout

I use git checkout - to change to the previous branch. It's handy for switching from a feature branch back to the main development branch and back again.

Kevin Thull

diff

I like the git diff --staged command to review all of the staged changes before committing.

Kevin Thull

status

I seem to touch many files when I work, and git status is a lifesaver. Understanding the state of the working directory and staging area with git status has helped me learn those core concepts in Git and make sure all my work is committed!

Ravi Lachhman, Field CTO at Shipa

squash (rebase -i)

I like to use this command to squash several commits into one. Start by using git rebase -i HEAD~# where # is the number of commits to squash. Change pick to squash on each commit that should become part of the one above it. Then edit your commit messages as you see fit. It keeps the commit history very tidy.

Ryan Marks

update-index

Use this with caution!

$ git update-index --assume-unchanged path/to/file

It's handy for marking a file unchanged that has local changes or just one of those pesky files that continually swears it's been changed even though you've done absolutely nothing to it.

Kevin Thull

worktree

One of my favorites is the git-worktree feature, which manages simultaneous checkouts of different branches in a repo without making a wholesale copy of the files.

Here's an example:

$ git worktree add ../feature-branch feature-branch

KURT W.K.

Wrap up

Now it's time to suggest your own favorite tips. What Git commands save you time, or prevent mistakes? What tips do you pass on to new Git users at your workplace? Let us know as we celebrate 17 years of Git goodness this week!

Opensource.com community members share their favorite Git tips for saving time or preventing mistakes.

Image by:

Opensource.com

Git Opensource.com community What to read next What Git aliases are in your .bashrc? A practical guide to using the git stash command This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Make your own Git subcommands

opensource.com - Wed, 04/06/2022 - 15:00
Make your own Git subcommands Seth Kenlon Wed, 04/06/2022 - 03:00 Up Register or Login to like.

Git is pretty famous for having lots of subcommands, like clone, init, add, mv, restore, bisect, blame, show, rebase, and many more. In a previous article, I wrote about the very useful rev-parse subcommand for Git. Even with all of these subcommands available, users still come up with functions to improve their Git experience. While you're free to create Git-related commands and run them as scripts, it's easy to make your own custom Git subcommands. You can even integrate them with Git through rev-parse.

More on Git What is Git? Git cheat sheet Markdown cheat sheet New Git articles Create a simple Git script

A script that integrates with Git can be as complex as you need it to be, or it can be short and straightforward.

As a simple example, assume you've created a script that gathers the file names of your latest commit and places them into a file called latest.txt. You use this script after every commit for reporting purposes, and you've decided it would be handy to be able to run the script as if it were a built-in feature of Git, for instance, with the command git report.

Currently, running git report renders this error:

$ git report
git: 'report' is not a git command. See 'git --help'.

The most similar command is
        bugreport

Here's the script that generates your report:

#!/bin/sh

TOP=$(git rev-parse --show-toplevel)
HASH=$(git log --pretty=format:'%h' -n 1)

mkdir "${TOP}"/reports || true

git diff-tree \
--no-commit-id --name-only \
-r HEAD > "${TOP}"/reports/$HASH

Save this file as git-report.sh somewhere in your PATH.

You're not going to run this script directly, so do include the .sh extension in the name. Make the script executable:

$ chmod +x git-report.shCreate the front-end command

You can force Git to run git report through rev-parse and launch your git-report.sh script instead of returning an error. Here's the script:

#!/bin/sh

git-report.sh

Save this file as git-report (do not use a .sh file extension) somewhere on your PATH. Make the script executable:

$ chmod +x git-reportRunning your custom Git command

Now test it out. First, create the infrastructure and some sample data:

$ mkdir myproject ; cd !$
$ git init
$ echo "foo" > hello.txt
$ git add hello.txt
$ git commit -m 'first file'
$ git report

Look inside the reports directory to see a record of your latest commit:

$ cat reports/2e3efd8
hello.txtPass arguments to your script

You can pass arguments through rev-parse, too. I help maintain a Git subcommand called Git-portal, which helps manage large multimedia files associated with a Git repository.

It's a little like Git LFS or Git Annex, except without the overhead of versioning the actual media files. (The symlinks to the files are kept under version control, but the contents of the files are treated independently, which is useful in scenarios where the artistic process is distinct from the development process.)

To integrate Git-portal with Git as a subcommand, I use a simple front-end shell script, which in turn invokes rev-parse for literal parsing.

The example script provided in this article can't take any parameters, but the actual Git scripts I write almost always do. Here's how arguments are passed, for example, to Git-portal:

#!/bin/sh

ARG=$(git rev-parse --sq-quote "$@")
CMD="git-portal.sh $ARG"
eval "$CMD"

The --sq-quote option quotes all arguments following git portal and includes them as new parameters for git-portal.sh, which is the script with all the useful functions in it. A new command is assembled into the CMD variable, and then that variable is evaluated and executed.

Here's a simple example you can run. It's a modified version of a script I use to resize and apply accurate copyright (or copyleft, as the case may be) EXIF data to images for a flat-file CMS I use Git to manage.

This is a simplified example, and there's no good reason for this script to be a Git subcommand, but it's demonstrative. You can use your imagination to find ways to expand it to use Git functions.

Call this file git-imager.sh:

#!/bin/sh
## Requires
# GNU Bash
# exiftool (sometimes packaged as perl-Image-exiftool)
# Image Magick

PIC="${1}"
COPY="-Copyright"
LEFT="${2}"

mogrify -geometry 512^x512 -gravity Center \
        -crop 512x512+0+0 "${1}"

exiftool -Copyright="${2}" "${1}"

The front-end script for Git integration passes all parameters (the file name and the license) through to the git-imager.sh script.

#!/bin/sh

ARG=$(git rev-parse --sq-quote "$@")
CMD="git-imager.sh $ARG"
eval "$CMD"

Try it out:

$ git imager logo.jpg "Tux CC BY-SA"
 1 image files updatedEasy Git customization

Creating your own Git subcommand makes your custom scripts feel like natural components of Git. For users, it makes the new subcommands easy to remember, and it helps your subcommands integrate into the rest of everyone's Git workflow.

Creating your own Git subcommand makes your custom scripts feel like natural components of Git.

Image by:

Ray Smith

Git What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Linux's Speculation Handling Was Messed Up After Resuming From Suspend For Boot CPU

Phoronix - Wed, 04/06/2022 - 07:36
Hitting the mainline Linux Git tree today was a rather interesting fix... It turns out that when Linux was resuming from S3 suspend, it wasn't correctly restoring the MSRs for the boot CPU around handling speculative execution mitigations...

AMD Branch Sampling "BRS" Feature To Land With Linux 5.19

Phoronix - Wed, 04/06/2022 - 03:40
While there are many new features with Linux 5.18 with its merge window having just ended days ago, feature code is already beginning to accumulate within the various "-next" branches for what will be Linux 5.19 this summer. Patches merged today get AMD Branch Sampling (BRS) functionality in place for Zen 3 processors with that next kernel cycle...

Fedora 37 Looks To Deprecate Legacy BIOS Support

Phoronix - Wed, 04/06/2022 - 01:29
For the Fedora 37 release later this year the developers are looking at deprecating legacy BIOS support and making UEFI a requirement for x86_64 systems...

Pages