Skip to content

Commit d6a5912

Browse files
authored
fix: (export to steady) do not create empty files when checking out changes
1 parent 94cd21c commit d6a5912

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

kaybee/internal/tasks/data/default_config.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,15 @@ export:
133133
[ -d $vulnerability_id/$commit_id/before/$(dirname $F) ] || mkdir -p $vulnerability_id/$commit_id/before/$(dirname $F)
134134
[ -d $vulnerability_id/$commit_id/after/$(dirname $F) ] || mkdir -p $vulnerability_id/$commit_id/after/$(dirname $F)
135135
136-
git -C $repo_dir show $commit_id~1:$F > $vulnerability_id/$commit_id/before/$F
137-
git -C $repo_dir show $commit_id:$F > $vulnerability_id/$commit_id/after/$F
136+
if ( git -C $repo_dir cat-file -e $commit_id~1:$F &> /dev/null )
137+
then
138+
git -C $repo_dir show $commit_id~1:$F > $vulnerability_id/$commit_id/before/$F
139+
fi
140+
141+
if ( git -C $repo_dir cat-file -e $commit_id:$F &> /dev/null )
142+
then
143+
git -C $repo_dir show $commit_id:$F > $vulnerability_id/$commit_id/after/$F
144+
fi
138145
done
139146
}
140147

0 commit comments

Comments
 (0)