Save saves the local modifications to a new stash. Stasher is the identity of the person performing the stashing. Message is the optional description along with the stashed state. Flags control the stashing process and are given as bitwise OR.
( stasher *Signature, message string, flags StashFlag)
| 45 | // Message is the optional description along with the stashed state. |
| 46 | // Flags control the stashing process and are given as bitwise OR. |
| 47 | func (c *StashCollection) Save( |
| 48 | stasher *Signature, message string, flags StashFlag) (*Oid, error) { |
| 49 | |
| 50 | oid := new(Oid) |
| 51 | |
| 52 | stasherC, err := stasher.toC() |
| 53 | if err != nil { |
| 54 | return nil, err |
| 55 | } |
| 56 | defer C.git_signature_free(stasherC) |
| 57 | |
| 58 | messageC := C.CString(message) |
| 59 | defer C.free(unsafe.Pointer(messageC)) |
| 60 | |
| 61 | runtime.LockOSThread() |
| 62 | defer runtime.UnlockOSThread() |
| 63 | |
| 64 | ret := C.git_stash_save( |
| 65 | oid.toC(), c.repo.ptr, |
| 66 | stasherC, messageC, C.uint32_t(flags)) |
| 67 | runtime.KeepAlive(c) |
| 68 | if ret < 0 { |
| 69 | return nil, MakeGitError(ret) |
| 70 | } |
| 71 | return oid, nil |
| 72 | } |
| 73 | |
| 74 | // StashApplyFlag are flags that affect the stash apply operation. |
| 75 | type StashApplyFlag int |