Skip to content

Commit

Permalink
Merge pull request packit#90 from TomasTomecek/fix-66
Browse files Browse the repository at this point in the history
add files with `git add -f` to bypass gitignore

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
  • Loading branch information
softwarefactory-project-zuul[bot] authored Sep 29, 2020
2 parents 625e024 + 48e210f commit a01eab4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist2src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def stage(self, add=None, exclude=None):
if exclude:
exclude = f":(exclude){exclude}"
logger.debug(exclude)
self.repo.git.add(add or ".", exclude)
self.repo.git.add(add or ".", "-f", exclude)

def create_tag(self, tag, branch):
"""Create a Git TAG at the tip of BRANCH"""
Expand Down
8 changes: 4 additions & 4 deletions macros.packit
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# if there are no patches, packitpatch never gets invoked and this will b/c of autosetup
%__scm_setup_patch(q)\
%{__git} init\
%{__git} add .\
%{__git} commit --allow-empty -a -m "%{NAME}-%{VERSION} base"
%{__git} add -f .\
%{__git} commit -q --allow-empty -a -m "%{NAME}-%{VERSION} base"

# %{1} = absolute path to the patch
# %{2} = patch ID
Expand All @@ -17,8 +17,8 @@

%__scm_setup_git(q)\
%{__git} init %{-q}\
%{__git} add .\
%{__git} commit %{-q} --allow-empty -a -m "%{NAME}-%{VERSION} base"
%{__git} add -f .\
%{__git} commit -q --allow-empty -a -m "%{NAME}-%{VERSION} base"

# commit_msg contains commit message of the last commit
%__scm_apply_git_am(qp:m:)\
Expand Down
6 changes: 4 additions & 2 deletions packitpatch
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ second_to_last_dir=$(basename $(dirname ${top_level_git_path}))
# the git repo exists here
if [ $second_to_last_dir != "BUILD" ]; then
git init
git add .
# we are doing -f to bypass .gitignore which can mask packit.yaml or the specfile
# https://github.com/packit/dist-git-to-source-git/issues/66#issuecomment-694284493
git add -f .
# that PWD magic prints the name of the PWD, which usually is NAME-VERSION
git commit --allow-empty -a -m "${PWD##*/} base"
fi
Expand Down Expand Up @@ -45,6 +47,6 @@ if [ "$patch_id" != "%{2}" ]; then
printf -v commit_message "${commit_message}\nlocation_in_specfile: ${patch_id}"
fi

git add .
git add -f .
# patches can be empty, rpmbuild if fine with it
git commit -m "$commit_message" --allow-empty
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# ("gcc", "c8s"),
("gdb", "c8s"), # conditional patching, a ton of if's and addition of more sources
("sqlite", "c8s"), # conditional patching + autoconf
("haproxy", "c8s"), # they ignore our files
]

TEST_PROJECTS_WITH_BRANCHES_SINGLE_COMMIT = [
Expand Down

0 comments on commit a01eab4

Please sign in to comment.