File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,9 @@ func Worktree(ctx context.Context, repo *Repository) *Tree {
111111}
112112
113113func Add (ctx context.Context , wt * Tree , path ns.NS ) {
114+ if IsStagingMuted (ctx ) {
115+ return
116+ }
114117 if _ , err := wt .Add (path .GitPath ()); err != nil {
115118 must .Panic (ctx , err )
116119 }
Original file line number Diff line number Diff line change 1+ package git
2+
3+ import "context"
4+
5+ type muteStagingCtxKey struct {}
6+
7+ func MuteStaging (ctx context.Context ) context.Context {
8+ return context .WithValue (ctx , muteStagingCtxKey {}, true )
9+ }
10+
11+ func UnmuteStaging (ctx context.Context ) context.Context {
12+ return context .WithValue (ctx , muteStagingCtxKey {}, false )
13+ }
14+
15+ func IsStagingMuted (ctx context.Context ) bool {
16+ v , ok := ctx .Value (muteStagingCtxKey {}).(bool )
17+ return ok && v
18+ }
You can’t perform that action at this time.
0 commit comments