Skip to content

Commit

Permalink
patch: format-patches with a standard abbrev setting
Browse files Browse the repository at this point in the history
Prior to this change, each .patch file we wrote would contain
abbreviated sha1 values. In Git 2.10 and earlier, these abbreviations
were seven characters long.

In Git v2.11.0, the core.abbrev default changed to "auto", which means
these abbreviation character lengths will scale up and down depending on
the size of the Git repository. They could be seven characters, or more.

This makes "rdopkg patch" non-idempotent across this version boundary.
Git v2.11 can rewrite .patch files to have longer abbreviations than
what older Git versions originally constructed. Practically speaking,
this divide can happen when running rdopkg on a RHEL 7 environment (with
older Git) and then running it on the same repo on Fedora 26 (with newer
Git).

The end result is that rdopkg can no longer tell which patches really
changed, and it incorrectly bumps the release, adds a %changelog, etc.
even when nothing changed on a -patches branch.

Hard-code the Git core.abbrev setting during the "format-patch" command
so that we write the same .patch files in all environments.

Change-Id: I4dee29415db21efa49cadacf483eff1fc7b8cc51
  • Loading branch information
ktdreyer committed Aug 1, 2017
1 parent 6c311a9 commit 9a0708b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rdopkg/actions/distgit/actions.py
Expand Up @@ -837,7 +837,8 @@ def update_patches(branch, local_patches_branch,
start_number = len(patch_fns) + 1

rng = git.rev_range(start_commit + '~', end_commit)
format_patch_cmd = ['format-patch', '--no-renames',
format_patch_cmd = ['-c', 'core.abbrev=7',
'format-patch', '--no-renames',
'--no-signature', '-N', '--ignore-submodules',
'--start-number', str(start_number), rng]

Expand Down

0 comments on commit 9a0708b

Please sign in to comment.