Open-source News

Phoronix Premium Black Friday Deal To Support Open-Source News, Linux Hardware Testing

Phoronix - Tue, 11/22/2022 - 19:40
It's that time of the year with "Black Friday" this week and the start of the holiday shopping season. As usual, there is the annual holiday deal for Phoronix Premium to enjoy it at a discounted rate. Unfortunately the state of the ad industry and rampant ad-block use continue to greatly hurt the sustainability of the site while Phoronix Premium allows for enjoying the website ad-free and multi-page articles on a single page...

AMD Releases Brotli-G For GPU-Accelerated Brotli Compression

Phoronix - Tue, 11/22/2022 - 19:01
After open-sourcing its Radeon Raytracing Analyzer code last week, this week AMD's GPUOpen team has a new open-source project announcement: Brotli-G...

oneVPL 2023.1 Released For Intel's Open-Source Video Processing Library

Phoronix - Tue, 11/22/2022 - 18:55
Intel has published a new version of its oneVPL library as its open-source oneAPI Video Processing Library for video encoding/decoding and media processing across CPUs, GPUs, and other accelerators...

Wayland Screen Sharing For Chrome/Chromium Improving - Enabled By Default Soon?

Phoronix - Tue, 11/22/2022 - 18:37
Red Hat engineer Jan Grulich has written a year-end summary about the ongoing work for supporting Wayland-based screen sharing for the Google Chrome/Chromium web browser. The code still isn't enabled by default but given the strides being made that could change "sooner than later" if all goes well...

SDL 2.26 Released, SDL3 Development Now Underway

Phoronix - Tue, 11/22/2022 - 17:38
SDL 2.26 has been officially released as the latest version of this widely-used library by cross-platform games and other software wishing to abstract various hardware/software differences between systems. With the release of SDL 2.26 out, SDL 3.0 is now officially under development...

Find bugs with the git bisect command

opensource.com - Tue, 11/22/2022 - 16:00
Find bugs with the git bisect command Dwayne McDaniel Tue, 11/22/2022 - 03:00

Have you ever found a bug in code and needed to know when it was first introduced? Chances are, whoever committed the bug didn't declare it in their Git commit message. In some cases, it might have been present for weeks, months, or even years, meaning you would need to search through hundreds or thousands of commits to find when the problem was introduced. This is the problem that git bisect was built to solve!

The git bisect command is a powerful tool that quickly checks out a commit halfway between a known good state and a known bad state and then asks you to identify the commit as either good or bad. Then it repeats until you find the exact commit where the code in question was first introduced.

Image by:

(Martin Grandjean, CC BY-SA 4.0)

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

This "mathmagical" tool works by leveraging the power of halving. No matter how many steps you need to get through, by looking at the halfway point and deciding if it is the new top or bottom of the list of commits, you can find any desired commit in a handful of steps. Even if you have 10,000 commits to hunt through, it only takes a maximum of 13 steps to find the first offending commit.

  1.  commit 1 bad <> commit 10,000 good => commit 5,000 is bad
  2.  commit 5,000 bad <> commit 10,000 good => commit 7,500 is good
  3.  commit 5,000 bad <> commit 7,500 good => commit 6,250 is good
  4.  commit 5,000 bad <> commit 6,250 good => commit 5,625 is bad
  5.  commit 5,625 bad <> commit 6,250 good => commit 5,938 is bad
  6.  commit 5,938 bad <> commit 6,250 good => commit 6,094 is good
  7.  commit 5,938 bad <> commit 6,094 good => commit 6,016 is bad
  8.  commit 6,016 bad <> commit 6,094 good => commit 6,055 is good
  9.  commit 6,016 bad <> commit 6,055 good => commit 6,036 is bad
  10.  commit 6036 bad <> commit 6055 good => commit 6046 is bad
  11.  commit 6,046 bad <> commit 6,055 good => commit 6,050 is bad
  12.  commit 6,050 bad <> commit 6,055 good => commit 6,053 is good
  13.  commit 6,053 bad <> commit 6,055 good => commit 6,054 is good

So, the first bad commit of the 10,000 is commit number 6,053. With git bisect, this would take a couple of minutes at maximum. I can't even imagine how long this would take to investigate crawling through each commit one at a time.

Using Git bisect

Using the git bisect command is very straightforward:

$ git bisect start
$ git bisect bad        # Git assumes you mean HEAD by default
$ git bisect good <ref> # specify a tag or commit ID for

Git checks out the commit in the middle and waits for you to declare either:

$ git bisect good
## or
$ git bisect bad

Then the bisect tool repeats checking out the commit halfway between good and bad commits until you tell it:

$ git bisect reset

Advanced users can even write scripts that determine good and bad states as well as any remediation actions to take upon finding the specific commit. You might not use the git bisect command every day of your life, but when you need it, it is a lifesaver.

Git's bisect tool saves time and energy by quickly identifying a bad commit.

Image by:

Pixabay, testbytes, CC0

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.

Pages