scmbreeze / scm_breeze

Adds numbered shortcuts to the output git status, and much more
https://madebynathan.com/2011/10/19/git-shortcuts-like-youve-never-seen-before/
MIT License
2.82k stars 192 forks source link

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

Open rightx2 opened 3 years ago

rightx2 commented 3 years ago

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

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:

rightx2 commented 3 years ago

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

lrntgr commented 2 years ago

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

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 commented 2 years ago

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
ghthor commented 2 years ago

Yes, the shell version needs to be worked on and is known to have some strange behavior. Glad you were able to fix your issue by installing ruby.

On Wed, Sep 29, 2021 at 04:57 lrntgr @.***> wrote:

I solved the issue by installing ruby.

Indeed, 'scm_breeze.sh' behaves differently depending on whethter ruby is present or not (cf code permalink https://github.com/scmbreeze/scm_breeze/blob/ff6af425e2769c55061d866c1e8fb4def4efab12/scm_breeze.sh#L30:L34 ):

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 (?).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scmbreeze/scm_breeze/issues/309#issuecomment-929978057, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABHEKRPB4QAWFDGAQX247DUELIJFANCNFSM4W4AQJAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.