git-lfs/test/test-push-file-with-branch-name.sh
epriestley ea639a53cf Fix git rev-list when a file exists with the same name as the branch
Fixes issue #1056.

When you try to push `master` but also have a file named  `master`, we run
`git rev-list ... master`. This is ambiguous, because `rev-list` accepts
paths or refs and `git` is unsure whether you mean the ref `master` or the
path `master.

Instead, run `git rev-list ... master --`, which is unambiguous.

This adds a failing test (trying to push a file named `master` to LFS), then
fixes the test by appending `--` to the command.
2016-03-19 11:40:30 -07:00

22 lines
420 B
Bash
Executable File

#!/usr/bin/env bash
. "test/testlib.sh"
begin_test "push a file with the same name as a branch"
(
set -e
reponame="$(basename "$0" ".sh")"
setup_remote_repo "$reponame"
clone_repo "$reponame" repo
git lfs track "master"
echo "master" > master
git add .gitattributes master
git commit -m "add master"
git lfs push --all origin master 2>&1 | tee push.log
grep "(1 of 1 files)" push.log
)
end_test