mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Fix #127 git-ignore won't add duplicates.
As per the bug identified in #127 git-ignore would add duplicate entries in .gitignore which is redundant and should not happen. grep will suitably verify that the entry doesn't exit but only if the file actually exists or we will get an error on stderr. check if the file exists with test -f and that the new entry is present or alternatively just go ahead and add the new value which will create the file if it didn't exist. Running the same command again does not add the duplicate.
This commit is contained in:
parent
ca7579e774
commit
7398d10bd4
|
|
@ -5,6 +5,6 @@ if test $# -eq 0; then
|
|||
else
|
||||
for pattern in $@; do
|
||||
echo "... adding '$pattern' to .gitignore"
|
||||
echo $pattern >> .gitignore
|
||||
(test -f .gitignore && grep -q $pattern .gitignore) || echo $pattern >> .gitignore
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue