git-rewrite-author icon indicating copy to clipboard operation
git-rewrite-author copied to clipboard

rewrite tags

Open glensc opened this issue 9 years ago • 8 comments

are you sure it rewrites tags? i.e annotated tags?

glensc avatar Apr 27 '16 10:04 glensc

i was thinking maybe commits created with GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL env vars cause problem.

however i'm unable to reproduce the problem i'm having with real repo

➔ mkdir test
➔ cd test
➔ git init
➔ unset GIT_COMMITTER_NAME  GIT_COMMITTER_EMAIL
➔ export GIT_AUTHOR_NAME='author' GIT_AUTHOR_EMAIL='author@localhost'

➔ date > test
➔ git add test
➔ git commit -am 'test'

➔ git tag tag1
➔ git show tag1
commit 1639b75464c38b91f42c62de4abf1bc320be1b2d
Author: author <author@localhost>
Date:   Wed Apr 27 15:00:21 2016 +0300


➔ git-rewrite-author -w "author <author@localhost>" "root <root@localhost>"
Rewrite 1639b75464c38b91f42c62de4abf1bc320be1b2d (1/1) (0 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/master' was rewritten
Ref 'refs/tags/tag1' was rewritten
Rewrite 2ef9d011606619b70c945531f96bd00c2379304a (1/1) (0 seconds passed, remaining 0 predicted)    
WARNING: Ref 'refs/heads/master' is unchanged
WARNING: Ref 'refs/tags/tag1' is unchanged
tag1 -> tag1 (2ef9d011606619b70c945531f96bd00c2379304a -> 2ef9d011606619b70c945531f96bd00c2379304a)

➔ git show tag1
commit 2ef9d011606619b70c945531f96bd00c2379304a
Author: root <root@localhost>
Date:   Wed Apr 27 15:00:21 2016 +0300

    test

glensc avatar Apr 27 '16 12:04 glensc

also git rewrite-author -l doesn't even show authors from annotated tags

glensc avatar Apr 27 '16 12:04 glensc

ok. reproduced. the reproducer requires that ~/.gitconfig does not exist.

repro.sh

➔ sh -x ../repro.sh 
+ test -d .git
+ test -f /home/glen/.gitconfig
+ unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
+ export 'GIT_AUTHOR_NAME=author' 'GIT_AUTHOR_EMAIL=author@localhost'
+ >test 
+ date
+ git add test
+ git commit -am test
[master (root-commit) 8d9e8af] test
 Author: author <author@localhost>
 Committer: Elan Ruusamäe <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+)
 create mode 100644 test
+ export 'GIT_AUTHOR_NAME=tag author' 'GIT_AUTHOR_EMAIL=tag-author@localhost'
+ git tag -am tagged tag1
+ git show tag1
tag tag1
Tagger: Elan Ruusamäe <[email protected]>
Date:   Wed Apr 27 15:14:06 2016 +0300

tagged

commit 8d9e8af63a4a57cfa94110c9a787cfc15f631557
Author: author <author@localhost>
Date:   Wed Apr 27 15:14:06 2016 +0300

    test

diff --git a/test b/test
new file mode 100644
index 0000000..ae5d084
--- /dev/null
+++ b/test
@@ -0,0 +1 @@
+K apr   27 15:14:06 EEST 2016
+ git-rewrite-author -w 'Elan Ruusamäe <[email protected]>' 'root <root@localhost>'
Rewrite 8d9e8af63a4a57cfa94110c9a787cfc15f631557 (1/1) (0 seconds passed, remaining 0 predicted)    
WARNING: Ref 'refs/heads/master' is unchanged
WARNING: Ref 'refs/tags/tag1' is unchanged
tag1 -> tag1 (8d9e8af63a4a57cfa94110c9a787cfc15f631557 -> 8d9e8af63a4a57cfa94110c9a787cfc15f631557)
Rewrite 8d9e8af63a4a57cfa94110c9a787cfc15f631557 (1/1) (0 seconds passed, remaining 0 predicted)    
Ref 'refs/heads/master' was rewritten
Ref 'refs/tags/tag1' was rewritten
tag1 -> tag1 (8d9e8af63a4a57cfa94110c9a787cfc15f631557 -> 43b058eb2ed475dfd19e695b72b55ddfedbb6f1d)
+ git show tag1
tag tag1
Tagger: Elan Ruusamäe <[email protected]>
Date:   Wed Apr 27 15:14:06 2016 +0300

tagged

commit 43b058eb2ed475dfd19e695b72b55ddfedbb6f1d
Author: author <author@localhost>
Date:   Wed Apr 27 15:14:06 2016 +0300

    test

diff --git a/test b/test
new file mode 100644
index 0000000..ae5d084
--- /dev/null
+++ b/test
@@ -0,0 +1 @@
+K apr   27 15:14:06 EEST 2016
➔ git rewrite-author -l
The following authors and committers have contributed:

author <author@localhost>
root <root@localhost>
➔ 

glensc avatar Apr 27 '16 12:04 glensc

i found command that shows all authors, even from annotated tags:

➔ git fast-export --no-data --all | sed -nre 's/^(author|committer|tagger) ([^>]+>).*/\2/p'|sort -u
author <author@localhost>
Elan Ruusamäe <[email protected]>
root <root@localhost>

glensc avatar Apr 27 '16 12:04 glensc

@glensc I have the same problem, it rewrite tags, but does not rewrite tags' authors!

@davidfokkema any fix for that planned?

victornoel avatar Dec 15 '16 10:12 victornoel

@victornoel Hmm. Well, I'll have to take a look. This is not as designed, of course. PR's are welcome, otherwise I'll try to make some time next week.

davidfokkema avatar Dec 16 '16 13:12 davidfokkema

@davidfokkema I tried to see how it could be done, but except by deleting and recreating every tags one by one, I couldn't find an elegant way to do it… but I haven't searched for long though :)

victornoel avatar Dec 16 '16 14:12 victornoel

Ok, thanks, I'll try to make some time!

davidfokkema avatar Dec 16 '16 14:12 davidfokkema