git-number icon indicating copy to clipboard operation
git-number copied to clipboard

git-number mix-up numbers

Open KES777 opened this issue 7 years ago • 6 comments

Despite on I wanna to delete 2 file. git-number tries to delete 1 instead.

Details:

 $ pwd -P
/home/kes/work/projects/github-forks/perl5
$ git-number
On branch blead
Your branch is behind 'origin/blead' by 1422 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

1	deleted:    pod/perldelta.pod

Untracked files:
  (use "git add <file>..." to include in what will be committed)

2	pod/perl5242delta.pod

no changes added to commit (use "git add" and/or "git commit -a")
$ git-number -c rm 2
rm /home/kes/work/projects/github-forks/perl5/pod/perldelta.pod
rm: cannot remove '/home/kes/work/projects/github-forks/perl5/pod/perldelta.pod': No such file or directory

KES777 avatar Nov 27 '17 08:11 KES777

It looks like you wanted to run git-number rm 2 but accidentally ran git-number -c rm 2. The former runs git rm pod/perldelta.pod while the latter runs rm pod/perldelta.pod. The file was already deleted from the hard disk so the latter command failed because rm could no longer find the file on disk.

holygeek avatar Nov 27 '17 08:11 holygeek

Ah sorry, I misinterpreted your report.

Could it be possible that the git number output is outdated, for example there was another git-number that was ran in another terminal, obsoleting the output shown here, maybe?

holygeek avatar Nov 27 '17 08:11 holygeek

nope. here is one terminal and fresh commands.

I have found next. there second file is link to first. So file is showed as deleted and untracked.

I think in some point git-number resolves symlink

KES777 avatar Nov 27 '17 09:11 KES777

Are you running a modified git-number, by any chance? If so, could you see if the issue is reproducible with a pristine git-number?

holygeek avatar Nov 27 '17 09:11 holygeek

The changes done in this commit could be the one that introduces this bug: https://github.com/holygeek/git-number/commit/8ffa6a6a4c92b34edb9f663d26c54c31f89b96d8 - It uses Cwd::abs_path which could explain what you're seeing.

holygeek avatar Nov 27 '17 09:11 holygeek

it seems so

KES777 avatar Nov 27 '17 11:11 KES777