<commit_before>package cmd

import (
	"flag"
	"fmt"
	"github.com/driusan/dgit/git"
	"os"
)

func Branch(c *git.Client, args []string) {
	flags := flag.NewFlagSet("branch", flag.ExitOnError)
	flags.SetOutput(flag.CommandLine.Output())
	flags.Usage = func() {
		flag.Usage()
		fmt.Fprintf(flag.CommandLine.Output(), "\n\nOptions:\n")
		flags.PrintDefaults()
	}

	// These flags can be moved out of these lists and below as proper flags as they are implemented
	for _, bf := range []string{"d", "delete", "D", "create-reflog", "f", "force", "m", "move", "M", "c", "copy", "C", "no-color", "i", "ignore-case", "no-column", "r", "remotes", "a", "all", "v", "vv", "verbose", "q", "quiet", "no-abbrev", "no-track", "unset-upstream", "edit-description"} {
		flags.Var(newNotimplBoolValue(), bf, "Not implemented")
	}
	for _, sf := range []string{"color", "abbrev", "column", "sort", "no-merged", "contains", "no-contains", "points-at", "format", "set-upstream-to", "u"} {
		flags.Var(newNotimplStringValue(), sf, "Not implemented")
	}

	flags.Parse(args)

	switch flags.NArg() {
	case 0:
		branches, err := c.GetBranches()
		if err != nil {
			fmt.Fprintln(os.Stderr, "Could not get list of branches.")
			return
		}
		head := c.GetHeadBranch()
		for _, b := range branches {
			if head == b {
				fmt.Print("* ")
			} else {
				fmt.Print("  ")
			}
			fmt.Println(b.BranchName())
		}
	case 1:
		headref, err := git.SymbolicRefGet(c, git.SymbolicRefOptions{}, "HEAD")
		if err != nil {
			return
		}
		b := git.Branch(headref)
		if err := c.CreateBranch(flags.Arg(0), b); err != nil {
			fmt.Fprintf(os.Stderr, "Could not create branch (%v): %v\n", flags.Arg(0), err)
		}
	default:
		flag.Usage()
		os.Exit(2)
	}

}<commit_msg>Added the ability to create a branch at a startpoint<commit_after>package cmd

import (
	"flag"
	"fmt"
	"github.com/driusan/dgit/git"
	"os"
)

func Branch(c *git.Client, args []string) {
	flags := flag.NewFlagSet("branch", flag.ExitOnError)
	flags.SetOutput(flag.CommandLine.Output())
	flags.Usage = func() {
		flag.Usage()
		fmt.Fprintf(flag.CommandLine.Output(), "\n\nOptions:\n")
		flags.PrintDefaults()
	}

	// These flags can be moved out of these lists and below as proper flags as they are implemented
	for _, bf := range []string{"d", "delete", "D", "create-reflog", "f", "force", "m", "move", "M", "c", "copy", "C", "no-color", "i", "ignore-case", "no-column", "r", "remotes", "a", "all", "v", "vv", "verbose", "q", "quiet", "no-abbrev", "no-track", "unset-upstream", "edit-description"} {
		flags.Var(newNotimplBoolValue(), bf, "Not implemented")
	}
	for _, sf := range []string{"color", "abbrev", "column", "sort", "no-merged", "contains", "no-contains", "points-at", "format", "set-upstream-to", "u"} {
		flags.Var(newNotimplStringValue(), sf, "Not implemented")
	}

	flags.Parse(args)

	switch flags.NArg() {
	case 0:
		branches, err := c.GetBranches()
		if err != nil {
			fmt.Fprintln(os.Stderr, "Could not get list of branches.")
			return
		}
		head := c.GetHeadBranch()
		for _, b := range branches {
			if head == b {
				fmt.Print("* ")
			} else {
				fmt.Print("  ")
			}
			fmt.Println(b.BranchName())
		}
	case 1:
		headref, err := git.SymbolicRefGet(c, git.SymbolicRefOptions{}, "HEAD")
		if err != nil {
			return
		}
		b := git.Branch(headref)
		if err := c.CreateBranch(flags.Arg(0), b); err != nil {
			fmt.Fprintf(os.Stderr, "Could not create branch (%v): %v\n", flags.Arg(0), err)
		}
	case 2:
		startpoint, err := git.RevParseCommitish(c, &git.RevParseOptions{}, flags.Arg(1))
		if err != nil {
			return
		}
		if err := c.CreateBranch(flags.Arg(0), startpoint); err != nil {
			fmt.Fprintf(os.Stderr, "Could not create branch (%v): %v\n", flags.Arg(0), err)
		}
	default:
		flag.Usage()
		os.Exit(2)
	}

}
{'fraction_non_alphanumeric': 0.2048962213943587, 'fraction_numerical': 0.0037253858435337944, 'mean_word_length': 3.8316195372750643, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7607314', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1431, 'n_words': 349}