Bug report: git remote prune does not take negative refspecs into account

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I found an issue with git and wanted to report this. Here is the filled result 
from `git bugreport` (sorry for the intermixed German, but I think the English 
statements should suffice to understand the issue).

Vielen Dank für das Ausfüllen eines Git-Fehlerberichts!
Bitte antworten Sie auf die folgenden Fragen, um uns dabei zu helfen, Ihr
Problem zu verstehen.

Was haben Sie gemacht, bevor der Fehler auftrat? (Schritte, um Ihr Fehler
zu reproduzieren)

1. I have configured a remote `upstream` with a refspec like `+refs/heads/
*:refs/upstream/heads/*`.
2. I have fetched remote `upstream` fetching two branches `foo` and `bar`.
3. I add another line to `.git/config` with a negative refspec
```
fetch = ^refs/heads/bar
```
4. I called `git fetch upstream` and `git remote prune upstream`.
5. Remove the refspec from step 2 in `.git/config` with some arbitrary names 
(e.g. `+refs/heads/baz:refs/upstream/heads/baz`), keep the negative refspec as 
it is
6. Fetch and prune (see step 4)
7. Undo step 5 and restore the original state as after step 3
8. Fetch and prune (see step 4)

Was haben Sie erwartet, was passieren soll? (Erwartetes Verhalten)
Expected behavior:

After the fetch in step 2 both branches are mirrored locally.

After the prune in line 4 the branch `bar` is dropped from the remotely 
fetched branches.

After step 6 both both remote branches `foo` and `bar` are no longer visible.
A possible error about unmatching branch `baz`.

After step 8 again a remote branch `foo` is existing.

Was ist stattdessen passiert? (Wirkliches Verhalten)
Real behavior:

After step 2: As intended

After step 4: Both remote branches are still visible. Nothing is pruned.

After step 6: Both remote branches are gone.

After step 8: Only `foo` is existing/fetched as remote branch.

Was ist der Unterschied zwischen dem, was Sie erwartet haben und was
wirklich passiert ist?
The difference of real and ideal behavior:

The difference is that after step 4 the remote branch `bar` is not pruned.

Sonstige Anmerkungen, die Sie hinzufügen möchten:

The steps 5~8 are there to verify the negative pathspec is working in general.
Fetching freshly takes the negativbe pathspec into account.

So the problem is within the pruning code.

[System Info]
git Version:
git version 2.30.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.10.10-arch1-1 #1 SMP PREEMPT Sat, 23 Jan 2021 23:59:48 +0000 
x86_64
Compiler Info: gnuc: 10.2
libc Info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/bash


[Aktivierte Hooks]

Thank you for looking into this.
Christian






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux