Correctly reset index before creating the first commit

parent fc88b314
......@@ -28,15 +28,17 @@ from gettext import gettext as _
import os
import sys
from . import util
from .util import check_branch, track_remote_branch, commit_lfs_file, checkout_lfs_file, list_lfs_files
from .util import *
import logging
import argparse
import sh
def do_commit(args: argparse.Namespace):
if check_branch(args.branch) is None:
if find_remote_branches(args.branch) is not None:
if find_remote_branches(args.branch):
track_remote_branch(args.branch)
else:
reset_index()
commit_lfs_file(args.tarball, args.branch)
def do_checkout(args: argparse.Namespace):
......
......@@ -72,6 +72,9 @@ def track_remote_branch(name: str):
commit, branch = remote_branches[0]
git.branch('--track', name, branch)
def reset_index():
git.rm('--cached', '-r', '--ignore-unmatch', '*')
def store_lfs_object(io: Any) -> str:
return str(git.lfs.clean(io.name, _in=io))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment