@@ -254,6 +254,90 @@ var gitBisectResetCmd = &cobra.Command{
254254 },
255255}
256256
257+ var gitBisectSkipCmd = & cobra.Command {
258+ Use : "skip [commit]" ,
259+ Short : "Skip a commit in bisecting" ,
260+ Run : func (cmd * cobra.Command , args []string ) {
261+ bisectArgs := append ([]string {"bisect" , "skip" }, args ... )
262+ bisect := exec .Command ("git" , bisectArgs ... )
263+ bisect .Stdout = os .Stdout
264+ bisect .Stderr = os .Stderr
265+ if err := bisect .Run (); err != nil {
266+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
267+ os .Exit (1 )
268+ }
269+ },
270+ }
271+
272+ var gitBisectLogCmd = & cobra.Command {
273+ Use : "log" ,
274+ Short : "Show bisect log" ,
275+ Run : func (cmd * cobra.Command , args []string ) {
276+ out , err := exec .Command ("git" , "bisect" , "log" ).Output ()
277+ if err != nil {
278+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
279+ os .Exit (1 )
280+ }
281+ fmt .Print (string (out ))
282+ },
283+ }
284+
285+ var gitBisectReplayCmd = & cobra.Command {
286+ Use : "replay <logfile>" ,
287+ Short : "Replay bisect log" ,
288+ Args : cobra .ExactArgs (1 ),
289+ Run : func (cmd * cobra.Command , args []string ) {
290+ out , err := exec .Command ("git" , "bisect" , "replay" , args [0 ]).Output ()
291+ if err != nil {
292+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
293+ os .Exit (1 )
294+ }
295+ fmt .Print (string (out ))
296+ },
297+ }
298+
299+ var gitBisectVisualizeCmd = & cobra.Command {
300+ Use : "visualize" ,
301+ Short : "Show bisect states in gitk" ,
302+ Run : func (cmd * cobra.Command , args []string ) {
303+ out , err := exec .Command ("git" , "bisect" , "visualize" ).Output ()
304+ if err != nil {
305+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
306+ os .Exit (1 )
307+ }
308+ fmt .Print (string (out ))
309+ },
310+ }
311+
312+ var gitBisectTermsCmd = & cobra.Command {
313+ Use : "terms" ,
314+ Short : "Show terms used by bisect" ,
315+ Run : func (cmd * cobra.Command , args []string ) {
316+ out , err := exec .Command ("git" , "bisect" , "terms" ).Output ()
317+ if err != nil {
318+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
319+ os .Exit (1 )
320+ }
321+ fmt .Print (string (out ))
322+ },
323+ }
324+
325+ var gitBisectRunCmd = & cobra.Command {
326+ Use : "run <cmd>..." ,
327+ Short : "Run a script to bisect automatically" ,
328+ Args : cobra .MinimumNArgs (1 ),
329+ Run : func (cmd * cobra.Command , args []string ) {
330+ bisectArgs := append ([]string {"bisect" , "run" }, args ... )
331+ bisect := exec .Command ("git" , bisectArgs ... )
332+ bisect .Stdout = os .Stdout
333+ bisect .Stderr = os .Stderr
334+ if err := bisect .Run (); err != nil {
335+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
336+ os .Exit (1 )
337+ }
338+ },
339+ }
340+
257341// git notes
258342var gitNotesCmd = & cobra.Command {
259343 Use : "notes" ,
@@ -290,6 +374,123 @@ var gitNotesShowCmd = &cobra.Command{
290374 },
291375}
292376
377+ var gitNotesEditCmd = & cobra.Command {
378+ Use : "edit [object]" ,
379+ Short : "Edit notes for an object" ,
380+ Run : func (cmd * cobra.Command , args []string ) {
381+ notesArgs := append ([]string {"notes" , "edit" }, args ... )
382+ notes := exec .Command ("git" , notesArgs ... )
383+ notes .Stdout = os .Stdout
384+ notes .Stderr = os .Stderr
385+ if err := notes .Run (); err != nil {
386+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
387+ os .Exit (1 )
388+ }
389+ },
390+ }
391+
392+ var gitNotesCopyCmd = & cobra.Command {
393+ Use : "copy <from-object> <to-object>" ,
394+ Short : "Copy notes between objects" ,
395+ Args : cobra .ExactArgs (2 ),
396+ Run : func (cmd * cobra.Command , args []string ) {
397+ out , err := exec .Command ("git" , "notes" , "copy" , args [0 ], args [1 ]).Output ()
398+ if err != nil {
399+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
400+ os .Exit (1 )
401+ }
402+ fmt .Print (string (out ))
403+ },
404+ }
405+
406+ var gitNotesAppendCmd = & cobra.Command {
407+ Use : "append [object]" ,
408+ Short : "Append to notes on an object" ,
409+ Run : func (cmd * cobra.Command , args []string ) {
410+ notesArgs := append ([]string {"notes" , "append" }, args ... )
411+ notes := exec .Command ("git" , notesArgs ... )
412+ notes .Stdout = os .Stdout
413+ notes .Stderr = os .Stderr
414+ if err := notes .Run (); err != nil {
415+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
416+ os .Exit (1 )
417+ }
418+ },
419+ }
420+
421+ var gitNotesRemoveCmd = & cobra.Command {
422+ Use : "remove [object]" ,
423+ Short : "Remove notes" ,
424+ Run : func (cmd * cobra.Command , args []string ) {
425+ notesArgs := append ([]string {"notes" , "remove" }, args ... )
426+ notes := exec .Command ("git" , notesArgs ... )
427+ notes .Stdout = os .Stdout
428+ notes .Stderr = os .Stderr
429+ if err := notes .Run (); err != nil {
430+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
431+ os .Exit (1 )
432+ }
433+ },
434+ }
435+
436+ var gitNotesListCmd = & cobra.Command {
437+ Use : "list [object]" ,
438+ Short : "List notes" ,
439+ Run : func (cmd * cobra.Command , args []string ) {
440+ notesArgs := append ([]string {"notes" , "list" }, args ... )
441+ out , err := exec .Command ("git" , notesArgs ... ).Output ()
442+ if err != nil {
443+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
444+ os .Exit (1 )
445+ }
446+ if len (out ) == 0 {
447+ fmt .Println ("No notes found" )
448+ } else {
449+ fmt .Print (string (out ))
450+ }
451+ },
452+ }
453+
454+ var gitNotesMergeCmd = & cobra.Command {
455+ Use : "merge <notes-ref>" ,
456+ Short : "Merge notes" ,
457+ Args : cobra .ExactArgs (1 ),
458+ Run : func (cmd * cobra.Command , args []string ) {
459+ out , err := exec .Command ("git" , "notes" , "merge" , args [0 ]).Output ()
460+ if err != nil {
461+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
462+ os .Exit (1 )
463+ }
464+ fmt .Print (string (out ))
465+ },
466+ }
467+
468+ var gitNotesPruneCmd = & cobra.Command {
469+ Use : "prune" ,
470+ Short : "Remove all notes for unreachable objects" ,
471+ Run : func (cmd * cobra.Command , args []string ) {
472+ out , err := exec .Command ("git" , "notes" , "prune" ).Output ()
473+ if err != nil {
474+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
475+ os .Exit (1 )
476+ }
477+ fmt .Print (string (out ))
478+ },
479+ }
480+
481+ var gitNotesGetRefCmd = & cobra.Command {
482+ Use : "get-ref" ,
483+ Short : "Show the current notes ref" ,
484+ Run : func (cmd * cobra.Command , args []string ) {
485+ out , err := exec .Command ("git" , "notes" , "get-ref" ).Output ()
486+ if err != nil {
487+ fmt .Fprintf (os .Stderr , "Error: %v\n " , err )
488+ os .Exit (1 )
489+ }
490+ fmt .Print (string (out ))
491+ },
492+ }
493+
293494// git fsck
294495var gitFsckCmd = & cobra.Command {
295496 Use : "fsck" ,
@@ -875,10 +1076,10 @@ func init() {
8751076 gitMvCmd .Flags ().BoolP ("force" , "f" , false , "Force move" )
8761077
8771078 // Bisect subcommands
878- gitBisectCmd .AddCommand (gitBisectStartCmd , gitBisectGoodCmd , gitBisectBadCmd , gitBisectResetCmd )
1079+ gitBisectCmd .AddCommand (gitBisectStartCmd , gitBisectGoodCmd , gitBisectBadCmd , gitBisectResetCmd , gitBisectSkipCmd , gitBisectLogCmd , gitBisectReplayCmd , gitBisectVisualizeCmd , gitBisectTermsCmd , gitBisectRunCmd )
8791080
8801081 // Notes subcommands
881- gitNotesCmd .AddCommand (gitNotesAddCmd , gitNotesShowCmd )
1082+ gitNotesCmd .AddCommand (gitNotesAddCmd , gitNotesShowCmd , gitNotesEditCmd , gitNotesCopyCmd , gitNotesAppendCmd , gitNotesRemoveCmd , gitNotesListCmd , gitNotesMergeCmd , gitNotesPruneCmd , gitNotesGetRefCmd )
8821083
8831084 // Add all new commands to gitCmd
8841085 gitCmd .AddCommand (
0 commit comments