-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass git commands directly to git (#2102)
This allows using all git commands. RELEASE_NOTES=[ENHANCEMENT] gopass git invokes git directly Fixes #2097 Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
- Loading branch information
1 parent
0387c55
commit d41fe65
Showing
4 changed files
with
101 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package action | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"strings" | ||
|
||
"github.com/gopasspw/gopass/internal/out" | ||
"github.com/gopasspw/gopass/pkg/ctxutil" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
// Git passes the git command to the underlying backend. | ||
func (s *Action) Git(c *cli.Context) error { | ||
ctx := ctxutil.WithGlobalFlags(c) | ||
store := c.String("store") | ||
|
||
sub, err := s.Store.GetSubStore(store) | ||
if err != nil || sub == nil { | ||
return ExitError(ExitGit, err, "failed to get sub store %s: %s", store, err) | ||
} | ||
|
||
args := c.Args().Slice() | ||
out.Noticef(ctx, "Running 'git %s' in %s...", strings.Join(args, " "), sub.Path()) | ||
cmd := exec.CommandContext(ctx, "git", args...) | ||
cmd.Dir = sub.Path() | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
cmd.Stdin = os.Stdin | ||
|
||
return cmd.Run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters