<commit_before>package cmd

import (
	"errors"
	"fmt"
	"log"
	"net/http"

	rq "github.com/parnurzeal/gorequest"
	"github.com/spf13/cobra"
)

var branchUpdateBranch string
var descDel *bool

// Updates the description text for a branch
var branchUpdateCmd = &cobra.Command{
	Use:   "update [database name]",
	Short: "Update the description for a branch",
	RunE: func(cmd *cobra.Command, args []string) error {
		// Ensure a database file was given
		if len(args) == 0 {
			return errors.New("No database file specified")
		}
		// TODO: Allow giving multiple database files on the command line.  Hopefully just needs turning this
		// TODO  into a for loop
		if len(args) > 1 {
			return errors.New("Only one database can be changed at a time (for now)")
		}

		// Ensure a branch name and description text were given
		if branchUpdateBranch == "" {
			return errors.New("No branch name given")
		}
		if msg == "" && *descDel == false {
			return errors.New("No description text given")
		}

		// Update the branch
		file := args[0]
		req := rq.New().Post(cloud+"/branch_update").
			Set("branch", branchUpdateBranch).
			Set("database", file)
		if msg != "" {
			req.Set("desc", msg)
		} else {
			req.Set("del", "true")
		}
		resp, _, errs := req.End()
		if errs != nil {
			log.Print("Errors when updating branch description:")
			for _, err := range errs {
				log.Print(err.Error())
			}
			return errors.New("Error when updating branch description")
		}
		if resp.StatusCode != http.StatusNoContent {
			if resp.StatusCode == http.StatusNotFound {
				return errors.New("Requested database or branch not found")
			}
			return errors.New(fmt.Sprintf("Description update failed with an error: HTTP status %d - '%v'\n",
				resp.StatusCode, resp.Status))
		}

		fmt.Println("Description updated")
		return nil
	},
}
<commit_msg>Minor message tweak for when a branch description is deleted<commit_after>package cmd

import (
	"errors"
	"fmt"
	"log"
	"net/http"

	rq "github.com/parnurzeal/gorequest"
	"github.com/spf13/cobra"
)

var branchUpdateBranch string
var descDel *bool

// Updates the description text for a branch
var branchUpdateCmd = &cobra.Command{
	Use:   "update [database name]",
	Short: "Update the description for a branch",
	RunE: func(cmd *cobra.Command, args []string) error {
		// Ensure a database file was given
		if len(args) == 0 {
			return errors.New("No database file specified")
		}
		// TODO: Allow giving multiple database files on the command line.  Hopefully just needs turning this
		// TODO  into a for loop
		if len(args) > 1 {
			return errors.New("Only one database can be changed at a time (for now)")
		}

		// Ensure a branch name and description text were given
		if branchUpdateBranch == "" {
			return errors.New("No branch name given")
		}
		if msg == "" && *descDel == false {
			return errors.New("No description text given")
		}

		// Update the branch
		file := args[0]
		req := rq.New().Post(cloud+"/branch_update").
			Set("branch", branchUpdateBranch).
			Set("database", file)
		if msg != "" {
			req.Set("desc", msg)
		} else {
			req.Set("del", "true")
		}
		resp, _, errs := req.End()
		if errs != nil {
			log.Print("Errors when updating branch description:")
			for _, err := range errs {
				log.Print(err.Error())
			}
			return errors.New("Error when updating branch description")
		}
		if resp.StatusCode != http.StatusNoContent {
			if resp.StatusCode == http.StatusNotFound {
				return errors.New("Requested database or branch not found")
			}
			return errors.New(fmt.Sprintf("Description update failed with an error: HTTP status %d - '%v'\n",
				resp.StatusCode, resp.Status))
		}

		// Inform the user
		if *descDel {
			fmt.Println("Description deleted")
		} else {
			fmt.Println("Description updated")
		}
		return nil
	},
}

{'fraction_non_alphanumeric': 0.129015271195366, 'fraction_numerical': 0.0026329647182727752, 'mean_word_length': 3.356651376146789, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2838002', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1210, 'n_words': 391}