@@ -246,40 +246,42 @@ pub fn update_workspace_commit(
246
246
index. read_tree ( & workspace_tree) ?;
247
247
index. write ( ) ?;
248
248
249
- // finally, update the refs/gitbutler/ heads to the states of the current virtual branches
250
- for branch in & virtual_branches {
251
- let wip_tree = repo. find_tree ( branch. tree ( ctx) ?) ?;
252
- let mut branch_head = repo. find_commit ( branch. head_oid ( & gix_repo) ?. to_git2 ( ) ) ?;
253
- let head_tree = branch_head. tree ( ) ?;
254
-
255
- // create a wip commit if there is wip
256
- if head_tree. id ( ) != wip_tree. id ( ) {
257
- let mut message = "GitButler WIP Commit" . to_string ( ) ;
258
- message. push_str ( "\n \n " ) ;
259
- message. push_str ( "This is a WIP commit for the virtual branch '" ) ;
260
- message. push_str ( branch. name . as_str ( ) ) ;
261
- message. push_str ( "'\n \n " ) ;
262
- message. push_str ( "This commit is used to store the state of the virtual branch\n " ) ;
263
- message. push_str ( "while you are working on it. It is not meant to be used for\n " ) ;
264
- message. push_str ( "anything else.\n \n " ) ;
265
- let branch_head_oid = repo. commit (
266
- None ,
267
- & committer,
268
- & committer,
269
- & message,
270
- & wip_tree,
271
- & [ & branch_head] ,
272
- // None,
249
+ if !ctx. app_settings ( ) . feature_flags . v3 {
250
+ // finally, update the refs/gitbutler/ heads to the states of the current virtual branches
251
+ for branch in & virtual_branches {
252
+ let wip_tree = repo. find_tree ( branch. tree ( ctx) ?) ?;
253
+ let mut branch_head = repo. find_commit ( branch. head_oid ( & gix_repo) ?. to_git2 ( ) ) ?;
254
+ let head_tree = branch_head. tree ( ) ?;
255
+
256
+ // create a wip commit if there is wip
257
+ if head_tree. id ( ) != wip_tree. id ( ) {
258
+ let mut message = "GitButler WIP Commit" . to_string ( ) ;
259
+ message. push_str ( "\n \n " ) ;
260
+ message. push_str ( "This is a WIP commit for the virtual branch '" ) ;
261
+ message. push_str ( branch. name . as_str ( ) ) ;
262
+ message. push_str ( "'\n \n " ) ;
263
+ message. push_str ( "This commit is used to store the state of the virtual branch\n " ) ;
264
+ message. push_str ( "while you are working on it. It is not meant to be used for\n " ) ;
265
+ message. push_str ( "anything else.\n \n " ) ;
266
+ let branch_head_oid = repo. commit (
267
+ None ,
268
+ & committer,
269
+ & committer,
270
+ & message,
271
+ & wip_tree,
272
+ & [ & branch_head] ,
273
+ // None,
274
+ ) ?;
275
+ branch_head = repo. find_commit ( branch_head_oid) ?;
276
+ }
277
+
278
+ repo. reference (
279
+ & branch. refname ( ) ?. to_string ( ) ,
280
+ branch_head. id ( ) ,
281
+ true ,
282
+ "update virtual branch" ,
273
283
) ?;
274
- branch_head = repo. find_commit ( branch_head_oid) ?;
275
284
}
276
-
277
- repo. reference (
278
- & branch. refname ( ) ?. to_string ( ) ,
279
- branch_head. id ( ) ,
280
- true ,
281
- "update virtual branch" ,
282
- ) ?;
283
285
}
284
286
285
287
Ok ( final_commit)
0 commit comments