Skip to content

Commit 7110bf8

Browse files
committed
Move extra tag-fetching step into init script
This makes three related changes: - Removes "git fetch --tags" from the instructions in the readme, because the goal of this command can be achieved in the init-tests-after-clone.sh script, and because this fetch command, as written, is probably only achieving that goal in narrow cases. In clones and fetches, tags on branches are fetched by default, and the tags needed by the tests are on branches. So the situations where "git fetch --tags" was helping were (a) when the remote recently gained the tags, and (b) when the original remote was cloned in an unusual way, not fetching all tags. In both cases, the "--tags" option is not what makes that fetch get the needed tags. - Adds "git fetch --all --tags" to init-tests-after-clone.sh. The "--all" option causes it to fetch from all remotes, and this is more significant than "--tags", since the tags needed for testing are on fetched branches. This achieves what "git fetch --tags" was achieving, and it also has the benefit of getting tags from remotes that have been added but not fetched from, as happens with an upstream remote that was manually added with no further action. (It also gets branches from those remotes, but if master is on multiple remotes but at different commits then "git checkout master" may not be able to pick one. So do this *after* rather than before that.) - Skips this extra fetch, and also the submodule cloning/updating step, when running on CI. CI jobs will already have taken care of cloning the repo with submodules recursively, and fetching all available tags. In forks without tags, the necessary tags for the test are not fetched--but the upstream remote is not set up on CI, so they wouldn't be obtained anyway, not even by refetching with "--all".
1 parent 19dfbd8 commit 7110bf8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ To clone the [the GitHub repository](https://github.com/gitpython-developers/Git
7676
```bash
7777
git clone https://github.com/gitpython-developers/GitPython
7878
cd GitPython
79-
git fetch --tags
8079
./init-tests-after-clone.sh
8180
```
8281

@@ -114,9 +113,9 @@ See [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525).
114113

115114
### RUNNING TESTS
116115

117-
_Important_: Right after cloning this repository, please be sure to have
118-
executed `git fetch --tags` followed by the `./init-tests-after-clone.sh`
119-
script in the repository root. Otherwise you will encounter test failures.
116+
_Important_: Right after cloning this repository, please be sure to have executed
117+
the `./init-tests-after-clone.sh` script in the repository root. Otherwise
118+
you will encounter test failures.
120119

121120
On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe`
122121
exists in `Git\mingw64\libexec\git-core\`.

init-tests-after-clone.sh

+4
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ git reset --hard HEAD~1
1919
git reset --hard HEAD~1
2020
git reset --hard HEAD~1
2121
git reset --hard __testing_point__
22+
23+
test -z "$TRAVIS" || exit 0 # CI jobs will already have taken care of the rest.
24+
25+
git fetch --all --tags
2226
git submodule update --init --recursive

0 commit comments

Comments
 (0)