Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gd [number] doesn't work in the submodule!! #309

Open
rightx2 opened this issue Feb 1, 2021 · 4 comments
Open

gd [number] doesn't work in the submodule!! #309

rightx2 opened this issue Feb 1, 2021 · 4 comments
Labels

Comments

@rightx2
Copy link

rightx2 commented Feb 1, 2021

  • Ubuntu 20.04
  • git version: git version 2.30.0
  • scm_breeze: master(0a687dc )

I have the main project repository which has a submodule. Below is the directory structure in my workspace

  • main: ~/Dropbox/Programming/Workspace/django/super_trading_project
  • submodule: ~/Dropbox/Programming/Workspace/django/super_trading_project/super_trading/backtester/event_driven
  • Run cat ....../event_driven/.git: gitdir: ../../../.git/modules/super_trading/backtester/event_driven

Problem

When the file in event_driven changed, gs showed this:

➤ Changes not staged for commit
#
#      modified: [1] ../../../.git/modules/super_trading/backtester/event_driven/alphas/mpaa.py

When I run just gd, it shows all diff information and it works well

But the problem is happening when I run gd [number]. gd 1 shows an error like this:

=> gd 1
fatal: ambiguous argument '~/Dropbox/Programming/Workspace/django/super_trading_project/.git/modules/super_trading/backtester/event_driven/alphas/mpaa.py': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

I have no idea why it happens!

Some notes:

  • gd [number] works well in parent modules. It does not work only in git submodule
  • All these strange things don't happen in Mac OS X
  • I was faced with the same problem even when I cloned the new parent module and submodule in the clean directory
@rightx2 rightx2 changed the title Strange behaviour of gd in submodule gd [number] doesn't work in the submodule!! Feb 1, 2021
@rightx2
Copy link
Author

rightx2 commented Feb 1, 2021

If I run with a raw command, git diff file_name(without scm_breeze), it works well..

@lrntgr
Copy link

lrntgr commented Sep 29, 2021

I'm facing the same issue here. From within the submodule directory:

  • regular git status works correctly
    $ git status
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
        foo.txt
    
  • SCM breeze gs displays a weird /.git/modules path
    $ gs
    # On branch:   |  [*] => $e*
    #
    ➤ Untracked files
    #
    #     untracked: [1] ../.git/modules/<SUBMODULE_DIRNAME>/foo.txt
    #
    

As a result, gd 1 fails due to this abnormal path : fatal: ambiguous argument '<REPO_DIRNAME>/.git/modules/<SUBMODULE_DIRNAME>/foo.txt': unknown revision or path not in the working tree., whereas git diff foo.txt works well.

My environment is:

$ lsb_release -a 
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS (fossa-cory-tgl X59)
Release:	20.04
Codename:	focal

$ git --version
git version 2.25.1

$ cd $HOME/.scm_breeze && git rev-parse --short HEAD
ff6af42

@lrntgr
Copy link

lrntgr commented Sep 29, 2021

I solved the issue by installing ruby.

Indeed, 'scm_breeze.sh' behaves differently depending on whethter ruby is present or not (cf code permalink):

 if ! type ruby > /dev/null 2>&1; then
   # If Ruby is not installed, fall back to the
   # slower bash/zsh implementation of 'git_status_shortcuts'
   source "$scmbDir/lib/git/fallback/status_shortcuts_shell.sh"
 fi
  • with ruby installed, gs is aliased to the git_status_shortcuts defined in status_shortcuts.sh, which works properly.
  • without ruby installed, gs is aliased to the git_status_shortcuts defined in status_shortcuts_shell.sh, which seems to be buggy (?).

@ghthor
Copy link
Member

ghthor commented Sep 29, 2021 via email

@ghthor ghthor added the bug label Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants