File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
completers/git_completer/cmd Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ func actionDiffArgs(cmd *cobra.Command) carapace.Action {
8989 var action carapace.Action
9090 if cmd .Flag ("cached" ).Changed {
9191 if len (expanded ) > 0 {
92- action = git .ActionCachedDiffs (expanded [0 ])
92+ action = git .ActionCachedRefDiffs (expanded [0 ])
9393 }
9494 } else {
9595 action = git .ActionRefDiffs (expanded ... )
Original file line number Diff line number Diff line change @@ -44,8 +44,15 @@ func init() {
4444 carapace .Gen (restoreCmd ).PositionalAnyCompletion (
4545 carapace .ActionCallback (func (c carapace.Context ) carapace.Action {
4646 if restoreCmd .Flag ("staged" ).Changed {
47+ if f := restoreCmd .Flag ("source" ); f .Changed {
48+ return git .ActionCachedRefDiffs (f .Value .String ())
49+ }
4750 return git .ActionChanges (git.ChangeOpts {Staged : true }).FilterArgs ()
4851 }
52+
53+ if f := restoreCmd .Flag ("source" ); f .Changed {
54+ return git .ActionRefDiffs (f .Value .String ())
55+ }
4956 return git .ActionChanges (git.ChangeOpts {Unstaged : true }).FilterArgs ()
5057 }),
5158 )
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ func ActionRefDiffs(refs ...string) carapace.Action {
138138}
139139
140140// ActionCachedDiffs completes changes between stage and given ref
141- func ActionCachedDiffs (ref string ) carapace.Action {
141+ func ActionCachedRefDiffs (ref string ) carapace.Action {
142142 return actionRefDiffs (true , ref )
143143}
144144
You can’t perform that action at this time.
0 commit comments